<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script type="module">
    import { reactive, effect, ref, toRefs, computed } from './index.js'
    // const product = reactive({
    //   name: "ihpone",
    //   price: 5000,
    //   count: 3
    // })
    // const price = ref(3000)
    // const count = ref(3)

    
    function useProduct(){
      const product = reactive({
        name: "ihpone",
        price: 5000,
        count: 3
      })
      return toRefs(product)
    }
    

    const { price, count } = useProduct()


    console.log(price,count);
    // let total = 0
    // effect(() => {
    //   total = price.value * count.value
    // })

    let total = computed(() => {
      return price.value * count.value
    })
    
    console.log(total);

    price.value = 4000
    console.log(total);

    count.value = 1
    console.log(total);


  </script>
</body>
</html>